/*************************************************
 *  Object:       Tric! A flying Ricotta.
 *  Authors:      Teo (matteo.piva-gmail.com)
                  Carletto (carlo.checchi-gmail.com)
*************************************************/

#ifndef __CONFIG__
#define __CONFIG__

    /* Module activations */
    //#define DEBUG
    #define NOESCCONFIG

    /* Pinout */
    #define LED_STATUS1                       PORTC.B2   // LED
    #define LED_STATUS2                       PORTB.B5   // LED
    #define LED_STATUS3                       PORTB.B3   // LED
    #define LED_AUX                           PORTB.B6   // LED
    #define FPV_ENABLE                        PORTA.B5   // Relay for FPV use
    #define BEEPER                            PORTA.B4   // Beeper alarm
    #define MOTORS_M1                         PORTC.B0   // Motor N.1 (Front Left)
    #define MOTORS_M2                         PORTC.B1   // Motor N.2 (Front Right)
    #define MOTORS_M3                         PORTC.B6   // Motor N.3 (Rear)
    #define MOTORS_MS                         PORTC.B7   // Yaw Servo
    #define RX                                PORTB.B2   // Receiver input

    /* Constants */
    #define PID_err_integral_min              0.01
    #define PID_processTime                   0.002  // 2ms dead band
    #define PID_Kp                            0.7
    #define PID_Kd                            -0.01
    #define PID_Ki                            0.15
    #define PID_output_min                    0
    #define PID_output_max                    255

    #define MOTORS_min_speed                  20
    #define MOTORS_max_speed                  250

    #define SENSORS_processTime               0.015
    #define SENSORS_filterTau                 0.05

    #define RX_minTimerValue                  96
    #define RX_maxTimerValue                  194
    #define RX_min_value                      -90
    #define RX_max_value                      90
    #define RX_min_throttle                   0
    #define RX_max_throttle                   255
    #define RX_throttleFactor                 0.9
    
    #define UTIL_VbattConversionFactor        55
    #define UTIL_minVbatt                     9.4

#endif